<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/26
 * Time: 15:39
 */

namespace app\index\model;


use think\Model;

class Add extends Model
{
    protected $table = 'demo';
    public function add($data)
    {
       $result =  $this->allowField(true)->save($data);
       if ($result)
       {
           return ['valid'=>1,'msg'=>'添加成功！'];
       }else
       {
           return ['valid'=>0,'msg'=>$this->getAttr()];
       }
    }
}